package org.csu.jpetstore_users_backend_pj.util;

import org.springframework.stereotype.Component;

import java.util.concurrent.ThreadLocalRandom;

@Component
public class CodeUtil {

    /**
     * 生成6位纯数字验证码
     * @return 6位数字字符串（如："123456"）
     */
    public static String generateNumericCaptcha() {
        StringBuilder captcha = new StringBuilder(6);
        for (int i = 0; i < 6; i++) {
            captcha.append(ThreadLocalRandom.current().nextInt(0, 10));
        }
        return captcha.toString();
    }
}